{include file="common/header.tpl"}
<section class="main">
	<nav class="left-col">{include file="common/navi-share.tpl"}</nav>
    <article class="right-col">
    	<h2><a href="{$back}">Danh sách sự kiện</a> &raquo; Cập nhật</h2></li>
        <form name="frmEdit" id="frmEdit" method="post" enctype="multipart/form-data" action="{$smarty.const.HOST_BACKEND}event/saveedit" class="ui">
            <input type="hidden" name="peventid" id="peventid" value="{$row.eventid}" />
            <input type="hidden" name="pcontent" id="pcontent" value="" />
            <input type="hidden" name="pcontact" id="pcontact" value="" />
            <input type="hidden" name="ptbfeature" id="ptbfeature" value="" />
            <input type="hidden" name="pfulladdr" id="pfulladdr" value="" />
            <ul>
                {if isset($smarty.session.EVENT_ERROR)}
                    <li class="error">
                       {include file="common/error.tpl" dataSession=$smarty.session.EVENT_ERROR}    
                    </li>
                {/if}
                {if $arrAlbum}
                    <li>
                        <label for="palbumid">Album sideshow:</label>
                        <div class="sel">
                            <select id="palbumid" name="palbumid">
                                <option value="0">--Chọn--</option>
                                {foreach item=item from=$arrAlbum}
                                    <option value="{$item.albumid}" {if isset($smarty.session.EVENT_POST.palbumid) && $smarty.session.EVENT_POST.palbumid==$item.albumid}selected="selected"{elseif $row.albumid == $item.albumid}selected="selected"{/if}>{$item.name} ({$item.timage} hình)</option>
                                {/foreach}
                            </select>
                        </div>
                    </li>
                {/if}
                <li>
                    <label for="pcategoryid">Danh mục <span class="required">*</span>:</label>
                    <div class="sel">
                        <select id="pcategoryid" name="pcategoryid">
                            <option value="0">---Chọn--</option>
                            {foreach item=item from=$arrCategory}
                                <option value="{$item.categoryid}" {if isset($smarty.session.EVENT_POST.pcategoryid) && $smarty.session.EVENT_POST.pcategoryid == $item.categoryid}selected="selected"{elseif $item.categoryid==$row.categoryid}selected="selected"{/if}>{$item.name}</option>
                            {/foreach}
                        </select>
                    </div>
                </li>                           
                <li>
                    <label for="pname">Tên sự kiện <span class="required">*</span>:</label>
                    <div class="txt">
                    	<input type="text" name="pname" id="pname" value="{if isset($smarty.session.EVENT_POST.pname)}{$smarty.session.EVENT_POST.pname|escape}{else}{$row.name|escape}{/if}" maxlength="{$smarty.const.VL_NAME_MAXLENGTH}" />
                    </div>
                </li>                
                <li>
                    <label for="plongitude">Kinh độ:</label>
                    <div class="txt">
                    	<input type="text" id="plongitude" name="plongitude" value="{if isset($smarty.session.EVENT_POST.plongitude)}{$smarty.session.EVENT_POST.plongitude|escape}{else}{$row.lng|escape}{/if}"/>
                    </div>
                </li>
                <li>
                    <label for="platitude">Vĩ độ:</label>
                    <div class="txt">
                    	<input type="text" id="platitude" name="platitude" value="{if isset($smarty.session.EVENT_POST.platitude)}{$smarty.session.EVENT_POST.platitude|escape}{else}{$row.lat|escape}{/if}"/>
                    </div>
                </li>                
                <li>
                    <label for="pprovince">Tỉnh/thành <span class="required">*</span>:</label>
                    <div class="sel">
                        <select id="pprovince" name="pprovince">
                            <option value="0">---Chọn--</option>
                            {if isset($smarty.session.EVENT_POST.pprovince)}
                                {html_options options=$arrProvince selected=$smarty.session.EVENT_POST.pprovince}
                            {else}
                                {html_options options=$arrProvince selected=$row.province}
                            {/if}
                        </select>
                    </div>
                </li>
                <li>
                    <label for="pdistrict">Quận/huyện <span class="required">*</span>:</label>
                    <div class="sel">
                        <select id="pdistrict" name="pdistrict">
                            <option value="0">---Chọn--</option>
                            {if isset($smarty.session.EVENT_POST.pdistrict)}
                                {html_options options=$arrDistrict selected=$smarty.session.EVENT_POST.pdistrict}
                            {else}
                                {html_options options=$arrDistrict selected=$row.district}
                            {/if}
                        </select>
                    </div>
                </li>  
                <li>
                    <label for="paddr">Địa chỉ <span class="required">*</span>:</label>
                    <div class="txt">
                    	<input type="text"  name="paddr" id="paddr" value="{if isset($smarty.session.EVENT_POST.paddr)}{$smarty.session.EVENT_POST.paddr}{else}{$row.addr|escape}{/if}"/>
                    </div>
                </li>  
                <li>
                    <label for="pdstart">Ngày diễn ra <span class="required">*</span>:</label>
                    <div class="date">
                        <input type="text" name="pdstart" id="pdstart" value="{if isset($smarty.session.EVENT_POST.pdstart)}{$smarty.session.EVENT_POST.pdstart|escape}{else}{$row.d_start|date_format:"%d/%m/%Y"}{/if}" readonly="readonly"/>
                        <input type="text" name="pdstart_hour" id="pdstart_hour" value="{if isset($smarty.session.EVENT_POST.pdstart_hour)}{$smarty.session.EVENT_POST.pdstart_hour}{else}{$row.d_start|date_format:"%H"}{/if}" class="half" placeholder="Giờ: 00-23" maxlength="2" />
                        <input type="text" name="pdstart_minute" id="pdstart_minute" value="{if isset($smarty.session.EVENT_POST.pdstart_minute)}{$smarty.session.EVENT_POST.pdstart_minute}{else}{$row.d_start|date_format:"%M"}{/if}" class="half" placeholder="Phút: 00-59" maxlength="2" />
                    </div>
                </li>
                <li>
                    <label for="pdend">Ngày kết thúc <span class="required">*</span>:</label>
                    <div class="date">
                        <input type="text"  name="pdend" id="pdend" value="{if isset($smarty.session.EVENT_POST.pdend)}{$smarty.session.EVENT_POST.pdend|escape}{else}{$row.d_end|date_format:"%d/%m/%Y"}{/if}" readonly="readonly"/>
                        <input type="text" name="pdstart_hour" id="pdstart_hour" value="{if isset($smarty.session.EVENT_POST.pdend_hour)}{$smarty.session.EVENT_POST.pdend_hour}{else}{$row.d_end|date_format:"%H"}{/if}" class="half" placeholder="Giờ: 00-23" maxlength="2" />
                        <input type="text" name="pdstart_minute" id="pdstart_minute" value="{if isset($smarty.session.EVENT_POST.pdend_minute)}{$smarty.session.EVENT_POST.pdend_minute}{else}{$row.d_end|date_format:"%M"}{/if}" class="half" placeholder="Phút: 00-59" maxlength="2" />                                
                    </div>                       
                </li>
                <li>
                    <label for="pprice">Giá (0:miễn phí):</label>
                    <div class="txt">
                    	<input type="text"  name="pprice" id="pprice" value="{if isset($smarty.session.EVENT_POST.pprice)}{$smarty.session.EVENT_POST.pprice|escape}{else}{$row.price|escape}{/if}" maxlength="3" onkeypress="javascript: return isNumberKey(event);"/> 
                    </div>
                </li> 
                <li>
                    <label for="pqty">Số lượng tham gia:</label>
                    <div class="txt">
                    	<input type="text"  name="pqty" id="pqty" value="{if isset($smarty.session.EVENT_POST.pqty)}{$smarty.session.EVENT_POST.pqty|escape}{else}{$row.qty|escape}{/if}" maxlength="3" onkeypress="javascript: return isNumberKey(event);"/> 
                    </div>                    
                </li>                             
                <li>
                    <label for="pqtyreg">Giới hạn số lượng đăng ký:</label>
                    <div class="txt">
                    	<input type="text"  name="pqtyreg" id="pqtyreg" value="{if isset($smarty.session.EVENT_POST.pqtyreg)}{$smarty.session.EVENT_POST.pqtyreg|escape}{else}{$row.qty_reg|escape}{/if}" maxlength="6" onkeypress="javascript: return isNumberKey(event);"/> 
                    </div>
                </li> 
                <li>
                    <label for="pafrom">Độ tuổi:</label>
                    <div class="age">
                    	<input type="text"  name="pafrom" id="pafrom" value="{if isset($smarty.session.EVENT_POST.pafrom)}{$smarty.session.EVENT_POST.pafrom|escape}{else}{$row.a_from}{/if}" maxlength="3" onkeypress="javascript: return isNumberKey(event);"/>
                        <label>-</label>
                        <input type="text"  name="pato" id="pato" value="{if isset($smarty.session.EVENT_POST.pato)}{$smarty.session.EVENT_POST.pato|escape}{else}{$row.a_to}{/if}" maxlength="3" onkeypress="javascript: return isNumberKey(event);"/>
                    </div>
                </li> 
                <li>
                    <label for="pimage">Hình đại diện:</label>
                    <div class="txt">
                    	<input type="file"  name="pimage" id="pimage" value="" />
                    </div>
                </li> 
                {if $row.image != ""}
                    <li>
                        <label>Hình đã đăng:</label>
                        <div class="txt">                        	
                        	{image path=$row.image type="event" attr="style=\"max-width:640px;float:left;\""}
                        </div>
                    </li>
                {/if}
                <li>
                    <label for="pshort">Tóm lược:</label>
                    <div class="area">
                    	<textarea rows="1" cols="1" name="pshort" id="pshort">{if isset($smarty.session.EVENT_POST.pshort)}{$smarty.session.EVENT_POST.pshort|escape}{else}{$row.short}{/if}</textarea>
                    </div>
                </li>                            
                <li>
                    <label for="pcontent">Nội dung <span class="required">*</span>:</label>
                    <div class="area">
                    	<textarea rows="1" cols="1" name="fckcontent" id="fckcontent">{if isset($smarty.session.EVENT_POST.pcontent)}{$smarty.session.EVENT_POST.pcontent|escape}{else}{$row.content}{/if}</textarea>
                    </div>
                </li> 
                <li>
                    <label for="pcontact">Liên hệ:</label>
                    <div class="area">
                    	<textarea rows="1" cols="1" name="fckcontact" id="fckcontact">{if isset($smarty.session.EVENT_POST.pcontact)}{$smarty.session.EVENT_POST.pcontact|escape}{else}{$row.contact}{/if}</textarea>
                    </div>                        
                </li> 
                <li>
                    <label for="ptag">Tag:</label>
                    <div class="txt">
                    	<input type="text"  name="ptag" id="ptag" value="{if isset($smarty.session.EVENT_POST.ptag)}{$smarty.session.EVENT_POST.ptag}{else}{$row.tag|escape}{/if}" maxlength="{$smarty.const.VL_TAG_MAXLENGTH}" />
                    </div>
                </li>   
                <li>
                    <label for="pfeature">Hiển thị trang chủ:</label>
                    <div class="sel">
                        <select id="padv" name="padv">
                            {if isset($smarty.session.EVENT_POST.pfeature)}
                                {html_options options=$arrSmarty.adv selected=$smarty.session.EVENT_POST.pfeature}
                            {else}
                                {html_options options=$arrSmarty.adv selected=$row.feature}
                            {/if}
                        </select>
                    </div>
                </li>    
                <li>
                	<label>Thông tin mở rộng:</label>
                    {include file="common/table-feature.tpl"}
                </li>                                            
                <li>
                    <button type="submit">Lưu dữ liệu</button>
                    <button type="button" onclick="document.location.href='{$back}'">Nhập lại</button>
                </li>
        	</ul>
        </form>                   	
  	</article>
</section>           	
{include file="common/footer.tpl"}
                
